package model

import "service/basic/config"

type Like struct {
	Id      uint32 `gorm:"column:id;type:int UNSIGNED;primaryKey;not null;" json:"id"`
	UserId  uint32 `gorm:"column:user_id;type:int UNSIGNED;not null;" json:"user_id"`
	ClassId uint32 `gorm:"column:class_id;type:int UNSIGNED;not null;" json:"class_id"`
}

func (l *Like) TableName() string {
	return "like"
}

func (l *Like) GetUserId() error {
	return config.DB.Where("user_id = ?", l.UserId).Limit(1).Find(&l).Error
}
